/*****************************************************************************
 * plum_kal_mutex.h
 *
 * Copyright (C) 2020 Jeasonvor <1101627719@qq.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 ****************************************************************************/

#ifndef __PLUM_KAL_MUTEX_H__
#define __PLUM_KAL_MUTEX_H__

/*****************************************************************************
 * Included Files
 ****************************************************************************/

/*****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/

#define PLUM_KAL_MUTEX_NAME_MAX 16

/*****************************************************************************
 * Public Types
 ****************************************************************************/

/*****************************************************************************
 * Public Data
 ****************************************************************************/

/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
 * Public Function Prototypes
 ****************************************************************************/

/**
 * @brief:  创建互斥锁
 *
 * @param[in]:  name    -   锁名称
 *
 * @return: 返回错误码
 */
plum_s32 plum_kal_mutex_create(PLUM_CONST plum_s8 *name);

/**
 * @brief:  删除互斥锁
 *
 * @param[in]:  name    -   锁名称
 *
 * @return: 返回错误码
 */
plum_s32 plum_kal_mutex_delete(PLUM_CONST plum_s8 *name);

/**
 * @brief:  上锁
 *
 * @param[in]:  name    -   锁名称
 *
 * @return: 返回错误码
 */
plum_s32 plum_kal_mutex_lock(PLUM_CONST plum_s8 *name);

/**
 * @brief:  解锁
 *
 * @param[in]:  name    -   锁名称
 *
 * @return: 返回错误码
 */
plum_s32 plum_kal_mutex_unlock(PLUM_CONST plum_s8 *name);

/**
 * @brief:  展示锁信息
 *
 * @param[in]:  name    -   锁名称，如果为空，则表示所有
 *
 * @return:
 */
plum_void plum_kal_mutex_show(PLUM_CONST plum_s8 *name);

/****************************************************************************/
#ifdef __cplusplus
}
#endif
/****************************************************************************/
#endif /* __PLUM_KAL_MUTEX_H__ */
/****************************************************************************/

/****************************************************************************/
/*                                                                          */
/*  End of file.                                                            */
/*                                                                          */
/****************************************************************************/
